/*
 * util.cpp
 *
 *  Created on: Nov 20, 2011
 *      Author: hao
 */

#include "util.h"

vector<string> splitEx(const string& src, string separate_character)
{
    vector<string> strs;

    int separate_characterLen = separate_character.size();
    int lastPosition = 0,index = -1;
    while (-1 != (index = src.find(separate_character,lastPosition)))
    {
        strs.push_back(src.substr(lastPosition,index - lastPosition));
        lastPosition = index + separate_characterLen;
    }
    string lastString = src.substr(lastPosition);
    if (!lastString.empty())
        strs.push_back(lastString);
    return strs;
}
